package com.mes.defece.controller;

import com.mes.common.pojo.MESResult;
import com.mes.defece.service.TaskService;
import com.mes.pojo.defece.Tasks;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 侯伟豪
 * @Company 起点编程
 * @Description
 * @Time 2024/10/25 15:23
 */
@RestController
@CrossOrigin
@RequestMapping("/task")
public class TaskController {
    @Autowired
    private TaskService taskService;
//    分页查询
    @GetMapping("/selectAll")
    public MESResult selectAll(Tasks tasks, @RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit) {
        return taskService.selectAll(tasks, page, limit);
    }
//    根据id查询数据信息
    @GetMapping("/selectById")
    public MESResult selectById(String taskId) {
        return taskService.selectById(taskId);
    }
//    根据id删除数据信息
    @DeleteMapping("/delete")
    public MESResult deleteTask(String taskId) {
        return taskService.deleteTask(taskId);
    }
}